﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _02_多维数组
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] arr_int = new int[2, 4];
            arr_int[0, 0] = 1;
            arr_int[0, 1] = 2;
            arr_int[0, 2] = 3;
            //arr_int[0, 3] = 4;
            arr_int[1, 0] = 5;
            arr_int[1, 1] = 6;
            arr_int[1, 2] = 7;
            //arr_int[1, 3] = 8;
            Console.WriteLine("------------foreach---------------");
            foreach (int i in arr_int)
            {
                Console.WriteLine(i);
            }
            Console.WriteLine("------------for---------------");
            for (int i = arr_int.GetLowerBound(0); i <= arr_int.GetUpperBound(0); i++)
            {
                for (int j = arr_int.GetLowerBound(1); j <= arr_int.GetUpperBound(1); j++)
                {
                    Console.WriteLine("多维数组 [{0},{1}]:{2}",i,j,arr_int[i,j]);
                }
            }
           
            Console.ReadKey();
        }
    }
}
